<?
/*
	CREATE TABLE forum (
		id smallint(6) NOT NULL auto_increment,
		name varchar(80) default NULL,
		description text,
		posts varchar(5) default NULL,
		PRIMARY KEY  (id),
		FULLTEXT KEY posts (posts)
	) TYPE=MyISAM;
*/
?>
<TABLE class=design bgColor=#ffffff cellPadding=3 cellSpacing=0 width=100% border='1' BORDERCOLOR="#C0C0C0" STYLE="border-collapse: collapse">
<TR>
	<TD class='a1'><strong>title</font></strong></td>
	<TD class='a1'><strong>owner</font></strong></td>
	<TD class='a1'><strong>number of posts</font></strong></td>
	<TD class='a1'><strong>action</font></strong></td>
</tr>
<?
	$sql = "SELECT * FROM forum";
	$result = mysql_query($sql) or die( mysql_error() );
	if ($result){
		while( $row = mysql_fetch_array($result) ){
			extract($row);
			list($username) = mysql_fetch_row( mysql_query("SELECT username FROM users WHERE uid='".$uid."'") );
?>
			<tr>
				<TD class='a1'>
					<?=$name?></font>
				</td>
				<TD class='a1'>
					<a href="users.php?a=e&step=2&uid=<?=$uid?>"><?=$username?></a></font>
				</td>
				<TD class='a1'>
					<?=getPosts($id)?></font>
				</td>
				<TD class='a1'>
						<a href="<?=$PHP_SELF?>?a=<?=$a?>&step=6&bid=<?=$id?>"><font color=black>manage posts</a> | 
						<a href="<?=$PHP_SELF?>?a=<?=$a?>&step=2&bid=<?=$id?>"><font color=black>edit</a> | 
						<a onclick="return confirm('are you sure you wish to delete this forum?');" href="<?=$PHP_SELF?>?a=<?=$a?>&step=4&bid=<?=$id?>"><font color=black>remove</a>
					</font>
				</td>
			</tr>
<?
		}
	}
?>
<tr>
	<td colspan=4 align=right>
		<br>
			<a href="<?=$PHP_SELF?>?a=<?=$a?>&step=5"><font color=black>add new forum</a>
		</font>
	</td>
</tr>
</table>